package com.dragon.loan.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class DecisionGeneralRule implements Serializable {


	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Long ruleId;

    private String decisionId;

    private String loanId;

    private String decisionLastAllCode;

    private String decisionLastAllDs;

    private String decisionLastAllType;

    private String decisionLastAllName;

    private String decisionLastAllList;

    public static List<DecisionGeneralRule> getDecisionGeneralRuleList(Map<String, Object> map, String loanId){
    	List<DecisionGeneralRule> decisionGeneralRules = new ArrayList<>(90);
    	for (int i = 1; i < 1000; i++) {
    		Object object = map.get("decision_last_all_code[" + i + "]");
    		Object object2 = map.get("decision_last_all_ds[" + i + "]");
    		Object object3 = map.get("decision_last_all_type[" + i + "]");
    		Object object4 = map.get("decision_last_all_name[" + i + "]");
    		Object object5 = map.get("decision_last_all_list[" + i + "]");
    		if(object == null 
    				&& object2 == null
    				&& object3 == null
    				&& object4 == null
    				&& object5 == null
    				) break;
    		DecisionGeneralRule decisionGeneralRule = new DecisionGeneralRule();
    		decisionGeneralRule.setDecisionLastAllCode(object != null ? object + "" : null);
    		decisionGeneralRule.setDecisionLastAllDs(object2 != null ? object2 + "" : null);
    		decisionGeneralRule.setDecisionLastAllType(object3 != null ? object3 + "" : null);
    		decisionGeneralRule.setDecisionLastAllName(object4 != null ? object4 + "" : null);
    		String decisionLastAllList = object5 != null ? object5 + "" : null;
    		decisionGeneralRule.setDecisionLastAllList(decisionLastAllList);
    		decisionGeneralRule.setLoanId(loanId);
    		decisionGeneralRules.add(decisionGeneralRule);
		}
    	return decisionGeneralRules;
    }
    
    /**
     * xishuashau专用
     * @param map
     * @param loanId
     * @return
     */
    public static List<DecisionGeneralRule> getDecisionGeneralRuleListXss(Map<String, Object> map, String loanId){
    	List<DecisionGeneralRule> decisionGeneralRules = new ArrayList<>(90);
    	for (int i = 1; i < 1000; i++) {
    		Object object = map.get("decision_last_all_code[" + i + "]");
    		Object object2 = map.get("decision_last_all_ds[" + i + "]");
    		Object object3 = map.get("decision_last_all_type[" + i + "]");
    		Object object4 = map.get("decision_last_all_name[" + i + "]");
    		Object object5 = map.get("decision_last_all_list[" + i + "]");
    		if(object == null 
    				&& object2 == null
    				&& object3 == null
    				&& object4 == null
    				&& object5 == null
    				) break;
    		DecisionGeneralRule decisionGeneralRule = new DecisionGeneralRule();
    		decisionGeneralRule.setDecisionLastAllCode(object != null ? object + "" : null);
    		decisionGeneralRule.setDecisionLastAllDs(object2 != null ? object2 + "" : null);
    		decisionGeneralRule.setDecisionLastAllType(object3 != null ? object3 + "" : null);
    		decisionGeneralRule.setDecisionLastAllName(object4 != null ? object4 + "" : null);
    		String decisionLastAllList = object5 != null ? object5 + "" : null;
    		if(decisionLastAllList == null || "0.0".equals(decisionLastAllList.trim())) {
    			continue;
    		}
    		decisionGeneralRule.setDecisionLastAllList(decisionLastAllList);
    		decisionGeneralRule.setLoanId(loanId);
    		decisionGeneralRules.add(decisionGeneralRule);
		}
    	return decisionGeneralRules;
    }
    
    /**
     * New   xishuashau专用
     * @param map
     * @param loanId
     * @return
     */
    public static List<DecisionGeneralRule> getDecisionGeneralRuleListXssNew(Map<String, Object> map, String loanId){
    	List<DecisionGeneralRule> decisionGeneralRules = new ArrayList<>(90);
    	for (int i = 1; i < 1000; i++) {
    		Object object = map.get("rule_code[" + i + "]");
    		Object object2 = map.get("decision_last_all_ds[" + i + "]");
    		Object object3 = map.get("decision_last_all_type[" + i + "]");
    		Object object4 = map.get("rule_name[" + i + "]");
    		Object object5 = map.get("rule_hit[" + i + "]");
    		if(object == null 
    				&& object2 == null
    				&& object3 == null
    				&& object4 == null
    				&& object5 == null
    				) break;
    		DecisionGeneralRule decisionGeneralRule = new DecisionGeneralRule();
    		decisionGeneralRule.setDecisionLastAllCode(object != null ? object + "" : null);
    		decisionGeneralRule.setDecisionLastAllDs(object2 != null ? object2 + "" : null);
    		decisionGeneralRule.setDecisionLastAllType(object3 != null ? object3 + "" : null);
    		decisionGeneralRule.setDecisionLastAllName(object4 != null ? object4 + "" : null);
    		String decisionLastAllList = object5 != null ? object5 + "" : null;
    		if(decisionLastAllList == null || "0.0".equals(decisionLastAllList.trim())) {
    			continue;
    		}
    		decisionGeneralRule.setDecisionLastAllList(decisionLastAllList);
    		decisionGeneralRule.setLoanId(loanId);
    		decisionGeneralRules.add(decisionGeneralRule);
		}
    	return decisionGeneralRules;
    }
     
    public Long getRuleId() {
        return ruleId;
    }

    public void setRuleId(Long ruleId) {
        this.ruleId = ruleId;
    }

    public String getDecisionId() {
        return decisionId;
    }

    public void setDecisionId(String decisionId) {
        this.decisionId = decisionId == null ? null : decisionId.trim();
    }

    public String getLoanId() {
        return loanId;
    }

    public void setLoanId(String loanId) {
        this.loanId = loanId == null ? null : loanId.trim();
    }

    public String getDecisionLastAllCode() {
        return decisionLastAllCode;
    }

    public void setDecisionLastAllCode(String decisionLastAllCode) {
        this.decisionLastAllCode = decisionLastAllCode == null ? null : decisionLastAllCode.trim();
    }

    public String getDecisionLastAllDs() {
        return decisionLastAllDs;
    }

    public void setDecisionLastAllDs(String decisionLastAllDs) {
        this.decisionLastAllDs = decisionLastAllDs == null ? null : decisionLastAllDs.trim();
    }

    public String getDecisionLastAllType() {
        return decisionLastAllType;
    }

    public void setDecisionLastAllType(String decisionLastAllType) {
        this.decisionLastAllType = decisionLastAllType == null ? null : decisionLastAllType.trim();
    }

    public String getDecisionLastAllName() {
        return decisionLastAllName;
    }

    public void setDecisionLastAllName(String decisionLastAllName) {
        this.decisionLastAllName = decisionLastAllName == null ? null : decisionLastAllName.trim();
    }

    public String getDecisionLastAllList() {
        return decisionLastAllList;
    }

    public void setDecisionLastAllList(String decisionLastAllList) {
        this.decisionLastAllList = decisionLastAllList == null ? null : decisionLastAllList.trim();
    }
}